﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IEnumerable<Task>>" %>

<%
    if (Model == null)
    {%>
    N/R
<%
        return;%>
<%
    }%>
<%
    if (Model.Count() == 0)
    {%>
    -
<%
    } %>
<%
    else
    {%>
    <h4 class="collapserHead"></h4>
    <ul style="display: none" >
        <%
        foreach (Task task in Model)
        {%>           
            <li class="<%
            if ((task.IsCompleted && task.CompletionDate == null) || (task.IsCompleted && task.CompletionDate != null && task.CompletionDate <= task.StartDate))
            {%>taskCompleted<%

            }
            else if(task.IsCompleted && task.CompletionDate != null && task.CompletionDate > task.StartDate)
            {%>taskCompletedNotInTime<%
            }%><%
            else
            {%>taskNotCompleted<%
            }%>">
                <%:task.Name%>
            <input type="hidden" taskId="<%:task.CheckPointId%>">
            <% if (ViewData["LoggedUser"] is SystemManager)
               {%>
                 
                <%:Html.CheckBox("isCompleted", task.IsCompleted,
                                                                    new { @class = "CompletionSetter", onclick = "taskCompletionChanged(this)" })%>
                  <% 
               }
             %>
            </li>
        <%
        }%>
    </ul>
<%
    }%>